From: Bryan Tong Minh Date: Thu, 31 Jul 2008 20:10:36 +0000 (+0000) Subject: API: Added iiprop=bitdepth to imageinfo and aiprop=bitdepth to allimages X-Git-Tag: 1.31.0-rc.0~46245 X-Git-Url: http://git.cyclocoop.org/%22.%24info%5B?a=commitdiff_plain;h=e2564980c3c350b6e112aee00566cbeecfb54f8c;p=lhc%2Fweb%2Fwiklou.git API: Added iiprop=bitdepth to imageinfo and aiprop=bitdepth to allimages --- diff --git a/CREDITS b/CREDITS index 990f3318e0..96fb428b1a 100644 --- a/CREDITS +++ b/CREDITS @@ -6,6 +6,7 @@ following names for their contribution to the product. * Alexandre Emsenhuber * Aryeh Gregor * Brion Vibber +* Bryan Tong Minh * Chad Horohoe * Greg Sabino Mullane * Hojjat diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 139bfcea91..90a4083500 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -56,6 +56,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN or other engine which doesn't support a separate title search function. This means you can use API search on Wikipedia without explicitly adding &srwhat=text to the query. +* Added iiprop=bitdepth to imageinfo and aiprop=bitdepth to allimages === Languages updated in 1.14 === diff --git a/includes/api/ApiQueryAllimages.php b/includes/api/ApiQueryAllimages.php index f8abaafe88..89a89e7e28 100644 --- a/includes/api/ApiQueryAllimages.php +++ b/includes/api/ApiQueryAllimages.php @@ -162,7 +162,8 @@ class ApiQueryAllimages extends ApiQueryGeneratorBase { 'dimensions', // Obsolete 'mime', 'sha1', - 'metadata' + 'metadata', + 'bitdepth', ), ApiBase :: PARAM_DFLT => 'timestamp|url', ApiBase :: PARAM_ISMULTI => true diff --git a/includes/api/ApiQueryImageInfo.php b/includes/api/ApiQueryImageInfo.php index d28792a12b..99201e20a7 100644 --- a/includes/api/ApiQueryImageInfo.php +++ b/includes/api/ApiQueryImageInfo.php @@ -148,6 +148,9 @@ class ApiQueryImageInfo extends ApiQueryBase { if( isset( $prop['archivename'] ) && $file->isOld() ) $vals['archivename'] = $file->getArchiveName(); + + if( isset( $prop['bitdepth'] ) ) + $vals['bitdepth'] = $file->getBitDepth(); return $vals; } @@ -166,7 +169,8 @@ class ApiQueryImageInfo extends ApiQueryBase { 'sha1', 'mime', 'metadata', - 'archivename' + 'archivename', + 'bitdepth', ) ), 'limit' => array( diff --git a/includes/filerepo/File.php b/includes/filerepo/File.php index 64b48e0aef..5b9a71e10c 100644 --- a/includes/filerepo/File.php +++ b/includes/filerepo/File.php @@ -264,7 +264,14 @@ abstract class File { * Overridden by LocalFile, UnregisteredLocalFile * STUB */ - function getMetadata() { return false; } + public function getMetadata() { return false; } + + /** + * Return the bit depth of the file + * Overridden by LocalFile + * STUB + */ + public function getBitDepth() { return 0; } /** * Return the size of the image file, in bytes diff --git a/includes/filerepo/LocalFile.php b/includes/filerepo/LocalFile.php index 7ed9ce0878..1964156e2d 100644 --- a/includes/filerepo/LocalFile.php +++ b/includes/filerepo/LocalFile.php @@ -453,6 +453,11 @@ class LocalFile extends File return $this->metadata; } + function getBitDepth() { + $this->load(); + return $this->bits; + } + /** * Return the size of the image file, in bytes * @public